package com.example.demo;

import java.util.Random;

public class TestRandom {
    public static void main(String[] args) {
        for (int i=0;i<100; i ++){
            getCount();
        }
    }
    private  static void getCount(){
        Random r = new Random();
        int count = 0;
        int num = 0;
        do {
            count++;
            int a = r.nextInt(100);
            if (a == 1) {
                num++;
            }
        } while (num !=99);
        System.out.println("一次一次抽抽到100次百分之一需要:"+count);
    }
}
